home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / xbtx.lha / Source / GfxDisplay.hpp < prev    next >
C/C++ Source or Header  |  1995-12-03  |  6KB  |  192 lines

  1. /*
  2. **    $Id: GfxDisplay.hpp 1.7 1995/12/03 12:16:23 olsen Exp olsen $
  3. **
  4. **    :ts=4
  5. */
  6.  
  7. /*
  8.  * Amiga changes copyright © 1995 by Olaf Barthel, All Rights Reserved
  9.  *
  10.  * Copyright (c) 1992, 1993 Arno Augustin, Frank Hoering, University of
  11.  * Erlangen-Nuremberg, Germany.
  12.  * All rights reserved.
  13.  *
  14.  * Redistribution and use in source and binary forms, with or without
  15.  * modification, are permitted provided that the following conditions
  16.  * are met:
  17.  * 1. Redistributions of source code must retain the above copyright
  18.  *    notice, this list of conditions and the following disclaimer.
  19.  * 2. Redistributions in binary form must reproduce the above copyright
  20.  *    notice, this list of conditions and the following disclaimer in the
  21.  *    documentation and/or other materials provided with the distribution.
  22.  * 3. All advertising materials mentioning features or use of this software
  23.  *    must display the following acknowledgement:
  24.  *      This product includes software developed by the University of
  25.  *      Erlangen-Nuremberg, Germany.
  26.  * 4. Neither the name of the University nor the names of its contributors
  27.  *    may be used to endorse or promote products derived from this software
  28.  *    without specific prior written permission.
  29.  *
  30.  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
  31.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  32.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
  33.  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  35.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  36.  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  37.  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  38.  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  39.  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40.  *
  41.  * This software has not been validated by the ``Bundesamt fuer Zulassungen in
  42.  * der Telekommunikation'' of the ``Deutsche Bundepost Telekom'' and thus
  43.  * must not be used for accessing the BTX-Network of the Telekom in Germany.
  44.  *
  45.  * Diese Software hat keine Zulassung durch das Bundesamt fuer Zulassungen in
  46.  * der Telekommunikation der Deutschen Bundespost Telekom und darf daher nicht
  47.  * am Netz der Deutschen Bundespost Telekom in Deutschland betrieben werden.
  48.  */
  49.  
  50. #ifndef _GFXDISPLAY_HPP
  51. #define _GFXDISPLAY_HPP 1
  52.  
  53. /****************************************************************************/
  54.  
  55. #include <intuition/intuitionbase.h>
  56. #include <graphics/gfxbase.h>
  57. #include <exec/memory.h>
  58.  
  59. /****************************************************************************/
  60.  
  61. #ifndef _TYPES_HPP
  62. #include "Types.hpp"
  63. #endif
  64.  
  65. #ifndef _BTXDISPLAY_HPP
  66. #include "BTXDisplay.hpp"
  67. #endif
  68.  
  69. #ifndef _FONT_H
  70. #include "Font.h"
  71. #endif
  72.  
  73. /****************************************************************************/
  74.  
  75. #define MAX_ZOOM 8
  76.  
  77. typedef struct btxchar
  78. {
  79.     struct btxchar    *link;
  80.     unsigned char    *raw;
  81.     unsigned char    bits;
  82.     struct BitMap    *map[4];
  83. } btxchar;
  84.  
  85. typedef struct colorentry
  86. {
  87.     unsigned char    red;
  88.     unsigned char    green;
  89.     unsigned char    blue;
  90. } colorentry;
  91.  
  92. class GfxDisplay : public BTXDisplay
  93. {
  94.     public:
  95.  
  96.         GfxDisplay();
  97.         ~GfxDisplay();
  98.  
  99.         LONG    Open(STRPTR PubScreenName,int XScale,int YScale,BOOL DirectRender);
  100.         VOID    Close(VOID);
  101.         VOID    MonitorData(int *btx_rows,int *btx_fontheight);
  102.         ULONG    WaitMask(VOID);
  103.         LONG    GetChar(VOID);
  104.         LONG    Waiting(VOID);
  105.         VOID    PutLine(STRPTR Line);
  106.  
  107.         void    xputc(int c,int set,int x,int y,int xdouble,int ydouble,int underline,int diacrit,int fg,int bg);
  108.         void    xclearscreen(void);
  109.         void    xcursor(int x,int y);
  110.         void    define_raw_DRC(int c,unsigned char *data,int bits);
  111.         void    define_color(int index,int r,int g,int b);
  112.         void    define_DCLUT(int entry,int index);
  113.         void    define_fullrow_bg(int row,int index);
  114.         void    free_DRCS(void);
  115.         void    default_colors(void);
  116.  
  117.     private:
  118.  
  119.         void                 xdraw_normal_char(btxchar *ch,int x,int y,int xd,int yd,int ul,btxchar *dia,int fg,int bg);
  120.         void                 xdraw_multicolor_char(btxchar *ch,int x,int y,int xd,int yd);
  121.         struct BitMap        *rawfont2bitmap(unsigned char *src,int xzoom,int yzoom);
  122.         struct BitMap        *createpixmapfromfont(unsigned char *src,int xzoom,int yzoom,int bits);
  123.         void                 init_fonts(void);
  124.         void                 free_font_pixmaps(void);
  125.         void                 store_colors(void);
  126.         void                 init_colormap(void);
  127.  
  128.         btxchar                 btx_font[6*96];
  129.         int                     fullrow_bg[24];     /* fullrow background color for eacch row */
  130.         int                     dclut[4];            /* map the 4-color DRC's */
  131.         colorentry             colormap[32+4+24];    /* store pixel value for each colorcell */
  132.         int                     cur_fg,
  133.                              cur_bg;
  134.         unsigned char         data[FONT_HEIGHT*2*2*FONT_WIDTH*2*2*MAX_ZOOM],
  135.                              row[FONT_WIDTH*2*2*MAX_ZOOM];
  136.  
  137.         int                    *rows;
  138.         int                    *fontheight;
  139.  
  140.         int                     ScaleX;
  141.         int                     ScaleY;
  142.  
  143.         WORD                 PutIndex;
  144.  
  145.         BOOL                 DirectRender;
  146.  
  147.         UBYTE                 FgBgMinterms[8];
  148.         UBYTE                 FgMinterms[8];
  149.         struct RastPort      LocalRPort;
  150.         struct BitMap         LocalBitMap;
  151.  
  152.         struct RastPort      TempRPort;
  153.  
  154.         struct Screen        *BtxScreen;
  155.         struct Window        *BtxWindow;
  156.  
  157.         struct ViewPort     *VPort;
  158.  
  159.         struct InputEvent     Event;
  160.  
  161.         LONG                 FgPen,BgPen;
  162.  
  163.         struct MsgPort        *WindowPort;
  164.         ULONG                 WindowMask;
  165.  
  166.         WORD                 WaitingChar;
  167.  
  168.         UWORD                 DisplayWidth;
  169.         UWORD                 DisplayHeight;
  170.  
  171.         LONG                 Pen[60];
  172.         struct RastPort     *RPort;
  173.  
  174.         VOID                 PreparePaintFgBg(UBYTE Fore,UBYTE Back,UBYTE *Minterms=NULL);
  175.         VOID                 PreparePaintFg(UBYTE Fore,UBYTE *Minterms=NULL);
  176.         VOID                 DrawTemplate(CONST struct BitMap *BitMap,CONST UBYTE *Minterms,UWORD Left,UWORD Top,UWORD Width,UWORD Height);
  177.         struct BitMap        *NewBitMap(LONG Depth,LONG Width,LONG Height);
  178.         VOID                 DisposeBitMap(struct BitMap *BitMap);
  179.         VOID                 SetFgPen(LONG Index);
  180.         VOID                 SetBgPen(LONG Index);
  181.         VOID                 SetPens(LONG Fg,LONG Bg);
  182.         VOID                 Fill(LONG Left,LONG Top,LONG Width,LONG Height);
  183.         VOID                 Complement(LONG Left,LONG Top,LONG Width,LONG Height);
  184.         VOID                 SetColour(LONG Index,UBYTE Red,UBYTE Green,UBYTE Blue);
  185.         BOOL                 InitColours(VOID);
  186.         LONG                 MapKey(struct IntuiMessage *Message);
  187.         ULONG                 FindBestModeID(Tag FirstTag,...);
  188.         VOID                 ReleaseColours(VOID);
  189. };
  190.  
  191. #endif    // _GFXDISPLAY_HPP
  192.